<template>
  <w-button />
</template>

<script>
import { WButton } from "blooming-season";
import "blooming-season/style";

export default {
  name: "Button",
  props: {
    task: {
      type: Object,
      required: true,
      default: () => ({ id: "", state: "", title: "" }),
      validator: (task) => ["id", "state", "title"].every((key) => key in task),
    },
  },
  emits: ["archive-task", "pin-task"],
  components: { WButton },
  setup(props, { emit }) {
    return {
      archiveTask() {
        emit("archive-task", props.task.id);
      },
      pinTask() {
        emit("pin-task", props.task.id);
      },
    };
  },
};
</script>
